<html>
<head><meta charset="utf-8"><title>tonight i&#x27;m barbara · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html">tonight i&#x27;m barbara</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="236271354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236271354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236271354">(Apr 27 2021 at 01:37)</a>:</h4>
<p>today, me and another friend (we're both Barbara i think) are helping a rust newbie ("Alan") work on some basic async code with actix-web.  i feel like many of the status quo stories we have are very relevant and very real!</p>



<a name="236271622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236271622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236271622">(Apr 27 2021 at 01:41)</a>:</h4>
<p>two quick concrete examples:  Alan needed to spawn a thread, but using tokio::spawn is likely not going to work (since actix-web doesn't use tokio 1).  not-obvious solution:  use actix_rt::spawn</p>



<a name="236271716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236271716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236271716">(Apr 27 2021 at 01:42)</a>:</h4>
<p>also, in some async code, we are locking a std::sync::Mutex, and while holding the lock we are making an async call.    we (the Barbaras) <em>think</em> this can deadlock, but aren't 100% sure</p>



<a name="236273868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236273868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ibraheem Ahmed <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236273868">(Apr 27 2021 at 02:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="222286">Andrew Chin (eminence)</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/tonight.20i'm.20barbara/near/236271622">said</a>:</p>
<blockquote>
<p>two quick concrete examples:  Alan needed to spawn a thread, but using tokio::spawn is likely not going to work (since actix-web doesn't use tokio 1).  not-obvious solution:  use actix_rt::spawn</p>
</blockquote>
<p>why is using <code>actix_rt::spawn</code> "not obvious"?</p>



<a name="236273880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236273880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ibraheem Ahmed <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236273880">(Apr 27 2021 at 02:17)</a>:</h4>
<p>I'm curious why one may think that</p>



<a name="236273932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236273932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ibraheem Ahmed <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236273932">(Apr 27 2021 at 02:18)</a>:</h4>
<p>actix-web uses the <code>actix_rt</code> runtime - so to spawn a task you use <code>actix_rt::spawn</code></p>



<a name="236274008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236274008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236274008">(Apr 27 2021 at 02:19)</a>:</h4>
<p>I think it's a combination of two things:   (1) general knowledge that "you can use tokio to do async stuff", and (2) a lack of knowledge that actix-web uses actix-rt</p>



<a name="236274090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236274090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ibraheem Ahmed <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236274090">(Apr 27 2021 at 02:20)</a>:</h4>
<p>Is there anything that could be done to make this more obvious?</p>



<a name="236274272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236274272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236274272">(Apr 27 2021 at 02:23)</a>:</h4>
<p>great question.  i don't really know.  i think one of the overall weaknesses with rust-async right now is that there can be a big gap of knowledge for someone like Alan.  he probably doesn't even have a good understanding what an "async runtime" even is or what it does</p>



<a name="236274302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236274302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236274302">(Apr 27 2021 at 02:24)</a>:</h4>
<p>do you happen to know if actix-rt is discussed anywhere in these docs?  <a href="https://actix.rs/docs/">https://actix.rs/docs/</a></p>



<a name="236274630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236274630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ibraheem Ahmed <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236274630">(Apr 27 2021 at 02:29)</a>:</h4>
<p>I don't think it is, I'll open an issue</p>



<a name="236274658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236274658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ibraheem Ahmed <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236274658">(Apr 27 2021 at 02:29)</a>:</h4>
<p>Thanks for bringing this up, it's always useful to hear first hand experience</p>



<a name="236274662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236274662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Doc Jones <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236274662">(Apr 27 2021 at 02:29)</a>:</h4>
<p>(deleted)</p>



<a name="236274898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236274898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236274898">(Apr 27 2021 at 02:32)</a>:</h4>
<p>i can anthropomorphise for a moment:  i bet actix-web feels a little stuck sometimes.  on one hand, actix-web doesn't want to have to teach the foundations of rust async from the ground up (it would perhaps want to assume some basic or general knowledge by its users).  on the other hand, it still wants to offer an attractive and usable framework for people to use even if they are new to async</p>



<a name="236275123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236275123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236275123">(Apr 27 2021 at 02:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="363998">Ibraheem Ahmed</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/tonight.20i'm.20barbara/near/236274630">said</a>:</p>
<blockquote>
<p>I don't think it is, I'll open an issue</p>
</blockquote>
<p>Thanks!  would you mind pinging me either here or on github once you do?</p>



<a name="236276490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236276490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ibraheem Ahmed <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236276490">(Apr 27 2021 at 02:57)</a>:</h4>
<p>Looks like there is already a relevant issue open: <a href="https://github.com/actix/actix-website/issues/110">https://github.com/actix/actix-website/issues/110</a></p>



<a name="236276602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236276602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236276602">(Apr 27 2021 at 02:59)</a>:</h4>
<p>ahh, nice <span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span></p>



<a name="236277600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236277600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236277600">(Apr 27 2021 at 03:14)</a>:</h4>
<p>(also a little offtopic, but while we were helping Alan, he was building his code on a raspberry pi.   it took between 90 and 100 seconds just compile to do a 1-line change!)</p>



<a name="236304654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/tonight%20i%27m%20barbara/near/236304654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/tonight.20i&#x27;m.20barbara.html#236304654">(Apr 27 2021 at 09:05)</a>:</h4>
<p>I love the liveblogging here :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>